package com.kwok.hotel.es.db.application;

import com.kwok.hotel.es.db.service.EsSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 当项目启动时运行
 */
@Component
public class ApplicationRunning implements CommandLineRunner {

    @Autowired
    private EsSearchService esSearchService;

    @Override
    public void run(String... args) throws Exception {
        //在项目启动时创建ES索引(库)
        esSearchService.createIndex();
    }

}
